<template>
  <div>
    
      <!-- <span>搜索</span> -->
      <!-- <input type="text" v-model="keywords" /> -->
      <van-search autofocus v-model="kw" placeholder="请输入搜索关键词" />
      <show-list :arr='arr'></show-list>
      <!-- <i class="iconfont icon-sousuo" @click="kw"></i> -->
    </div>
  
 
</template>


<script>
// import axios from "axios";
import { reqsearch } from '../../http/http';
export default {
  data() {
    return {
      kw: "",
      arr: [],
    };
  },
  watch:{
   kw() {
     if(this.kw === ''){
       this.arr = [];
       return
     }
     reqsearch({
        
          keywords: this.kw,
        
      }).then((res) => {
        // console.log('222',this.keywords);
        if(res.data.code==200){
 this.arr = res.data.list ? res.data.list : [];
        }
        
       
      });
      // this.keywords = "";
      
    }
  },
  // methods: {
  //   getSearch() {
  //     console.log('sss',this.keywords);
      
     
      
  //   },
  // },
};
</script>

<style scoped>
.search_ipt {
  display: flex;
  justify-content: space-evenly;
  justify-items: center;
  height: 0.4rem;
  margin-bottom: 0.2rem;
}
.list_shop img {
  width: 3rem;
  height: 2rem;
}
input {
  width: 4.5rem;
  height: 0.4rem;
}
i {
  font-size: 0.4rem;
}
</style>